<?php

namespace Weapp\Product;

use Weapp\Basic\Basic;

/**
 * 验证二维码管理
 * Class Qrcode
 * @url https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/minishopopencomponent/API/qrcode/gen_qrcode.html
 * @package Weapp/Product
 */
class Qrcode extends Basic
{
    /**
     * 生成验证二维码
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function gen($data)
    {
        $url = 'product/qrcode/gen';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }
    /**
     * 获取验证二维码
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function get($data)
    {
        $url = 'product/qrcode/get';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }
    /**
     * 查询验证二维码状态
     * @param array $data
     * @return array
     * @throws \Weapp\Exceptions\InvalidResponseException
     * @throws \Weapp\Exceptions\LocalCacheException
     */
    public function check($data)
    {
        $url = 'product/qrcode/check';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, $data, true);
    }
}
